package com.play.ballen.me.adapter

import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.play.ballen.R
import com.play.ballen.me.entity.TeamRecommend
import com.yuven.baselib.utils.ResourceUtil

class TeamInviteRecordAdapter(data: MutableList<TeamRecommend>) :
    BaseQuickAdapter<TeamRecommend, BaseViewHolder>(R.layout.item_team_invite_record, data) {

    override fun convert(holder: BaseViewHolder, item: TeamRecommend) {
        holder.setText(R.id.tvAccountValue, item.email)
        holder.setText(R.id.tvBallValue, item.count)
        holder.setText(R.id.tvTimeValue, item.reg_time)

        holder.setText(
            R.id.tvMissionRewardValue,
            ResourceUtil.getString(R.string.price_unit_bmt, item.task_income)
        )
        val tvMissionStatusValue = holder.getView<TextView>(R.id.tvMissionStatusValue)
        if (item.task_status == 1) {
            tvMissionStatusValue.text =
                ResourceUtil.getString(R.string.team_mission_status_complete)
            tvMissionStatusValue.setTextColor(
                ContextCompat.getColor(
                    context,
                    R.color.color_team_mission_complete
                )
            )
        } else {
            tvMissionStatusValue.text =
                ResourceUtil.getString(R.string.team_mission_status_incomplete)
            tvMissionStatusValue.setTextColor(
                ContextCompat.getColor(
                    context,
                    R.color.color_team_mission_incomplete
                )
            )
        }
    }

}